#include "stdafx.h"
#include "request.h"
#include "globals.h"
#include "group.h"
#include "sklad.h"
#include "SpawnPoint.h"


request::request(Table& tbl)
{
	setId(typeid(*this).name());
	tbl.Get("ID",id);
    tbl.Get("SENDER",sender_id);
    tbl.Get("RECEPIENT",recepient_id);
	//tbl.Get("",what);
//	char ss[1024];

//	tbl.Get("ITEM",ss);
//	this->item=std::string(ss);

    tbl.Get("AMOUNT",amount);
	tbl.Get("TTL",ttl);
	tbl.Get("TEL",tel);
/*
	tbl.Get("",sendertype);
	tbl.Get("",recepienttype);
*/
}

request::request(int rType, float tons, identifiable* who_asks)
{
/*
	id;
	sender_id;
	recepient_id;
	item;
	amount;
	ttl;
	tel;
	sendertype;
	recepienttype;
	sender;
	recepient;
	executor;
*/
	setId(typeid(*this).name());
	item=rType;
	amount=tons;
	sender=who_asks;
	recepient=0;
	executor=0;
	tel=0;
	ttl=g_ReqLifeMax;
}

void request::serialize(Serializer& serializer)
{
	serializer << id << sender_id << recepient_id << item << amount << ttl << tel;
	serializer << sendertype << recepienttype << sender << recepient << executor;
}